package com.beyondsoft.common.activiti.service;

import com.beyondsoft.common.activiti.model.DiagramResource;
import com.beyondsoft.common.activiti.model.WorkflowDefData;
import org.activiti.engine.repository.Deployment;

import java.io.InputStream;
import java.io.OutputStream;
import java.util.List;

/**
 * 流程部署相关
 *
 * @author zhangyan
 * @version $ Id: WorkFlowDeploymentService.java, v 0.1 2020/6/28 14:13 zhangyan Exp $
 */
public interface WorkFlowDeploymentService {

    /**
     * 部署
     *
     * @param resources
     */
    void deploy(List<DiagramResource> resources);

    /**
     * 部署
     *
     * @param name
     * @param bpmnResourceName
     * @param imgResourceName
     * @return
     */
    String deploy(String name, String bpmnResourceName, String imgResourceName);

    /**
     * 创建流程并部署
     *
     * @param workflow
     */
    Deployment addDeployment(WorkflowDefData workflow);

    /**
     * 删除流程部署
     *
     * @param deploymentId 部署编号
     * @param cascade      是否级联删除
     * @return
     */
    void delDeployment(String deploymentId, boolean cascade);

    /**
     * 数据库中存在的流程文档转化为模型
     *
     * @param processDefinitionId
     * @return
     */
    WorkflowDefData queryDeployment(String processDefinitionId);

    /**
     * 流程图
     *
     * @param procInstId
     * @param outputStream
     */
    void showDiagram(String procInstId, OutputStream outputStream);

    InputStream showDiagram(String procInstId);

    byte[] showDiagramByte(String procInstId);
}
